<template>
  <div>
    <button @click="showImg">切换显示</button>
    <br />
    <img ref="img" v-if="isShow" src="../../../../上传图片/小孩.jpg" alt="" />
  </div>
</template>

<script>
export default {
  name: 'nexttick',
  data () {
    return {
      isShow: false
    }
  },
  created () {
    console.log(this.$route.query)
    // console.log(this.$route.query.data.name)
    // console.log(this.$route.query.data.age)
  },
  methods: {
    showImg () {
      this.isShow = true
      // 此时无法获取这个值
      // console.log(this.$refs.img)
      this.$nextTick(() => {
        console.log(this.$refs.img)
      })
    }
  }
}
</script>

<style></style>
